/*
 * @Author: Cumelmell
 * @Date: 2020-04-27 16:51:39
 * @LastEditors: Cumelmell
 * @LastEditTime: 2020-04-27 16:51:39
 */
import { getDefaultSettings } from '@/settings';

const state = getDefaultSettings();

const mutations = {
  CHANGE_SETTING: (state, { key, value }) => {
    if (state.hasOwnProperty(key)) {
      state[key] = value;
    }
  }
};

const actions = {
  changeSetting ({ commit }, data) {
    commit('CHANGE_SETTING', data);
  }
};

export default {
  namespaced: true,
  state,
  mutations,
  actions
};
